package com.ruoyi.safe.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.safe.service.IListTypeService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.safe.mapper.ListManageMapper;
import com.ruoyi.safe.domain.ListManage;
import com.ruoyi.safe.service.IListManageService;

import javax.annotation.Resource;

/**
 * 管理清单Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-11-06
 */
@Service
public class ListManageServiceImpl implements IListManageService 
{
    @Autowired
    private ListManageMapper listManageMapper;
    @Autowired
    private IListTypeService listTypeService;

    /**
     * 查询管理清单
     * 
     * @param id 管理清单主键
     * @return 管理清单
     */
    @Override
    public ListManage selectListManageById(Long id)
    {
        return listManageMapper.selectListManageById(id);
    }

    /**
     * 查询管理清单列表
     * 
     * @param listManage 管理清单
     * @return 管理清单
     */
    @Override
    public List<ListManage> selectListManageList(ListManage listManage)
    {
        return listTypeService.processList(listManageMapper.selectListManageList(listManage));
    }
    /**
     * 查询管理清单列表
     *
     * @param listManage 管理清单
     * @return 管理清单
     */
    @Override
    public List<ListManage> selectListManageListAll(ListManage listManage)
    {
        return listManageMapper.selectListManageListAll(listManage);
    }
    /**
     * 新增管理清单
     * 
     * @param listManage 管理清单
     * @return 结果
     */
    @Override
    public int insertListManage(ListManage listManage)
    {
        listManage.setCreateTime(DateUtils.getNowDate());
        listManage.setCreateBy(SecurityUtils.getUsername());
        listManage.setId(IdUtil.getSnowflakeNextId());
        return listManageMapper.insertListManage(listManage);
    }

    /**
     * 修改管理清单
     * 
     * @param listManage 管理清单
     * @return 结果
     */
    @Override
    public int updateListManage(ListManage listManage)
    {
        listManage.setUpdateTime(DateUtils.getNowDate());
        listManage.setUpdateBy(SecurityUtils.getUsername());
        return listManageMapper.updateListManage(listManage);
    }

    /**
     * 批量删除管理清单
     * 
     * @param ids 需要删除的管理清单主键
     * @return 结果
     */
    @Override
    public int deleteListManageByIds(Long[] ids)
    {
        return listManageMapper.deleteListManageByIds(ids);
    }

    /**
     * 删除管理清单信息
     * 
     * @param id 管理清单主键
     * @return 结果
     */
    @Override
    public int deleteListManageById(Long id)
    {
        return listManageMapper.deleteListManageById(id);
    }
}
